package com.taotao.delayjob.core.model;

import com.alibaba.fastjson2.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 任务重试实例
 *
 * @author Fan Beibei
 * @date 2024-07-17 10:22:25
 */
@Data
public class RetryInst implements Serializable {

    @ApiModelProperty(value = "主键")
    private Long id;
    @ApiModelProperty(value = "业务类型编码")
    private String busiCode;
    @ApiModelProperty(value = "业务编号")
    private String busiNo;
    @ApiModelProperty(value = "业务参数")
    private String param;
    @ApiModelProperty(value = "最大重试次数")
    private Integer maxNum;
    @ApiModelProperty(value = "当前重试次数")
    private Integer curNum;
    @ApiModelProperty(value = "首次重试延迟时间（秒）")
    private Integer firstDelay;
    @ApiModelProperty(value = "重试间隔时间（秒）")
    private Integer intervalSeconds;
    @ApiModelProperty(value = "下次重试时间")
    private Long nextTriggerTime;
    @ApiModelProperty(value = "当前执行状态:not_success-未成功;success-成功")
    private String status;
    @ApiModelProperty(value = "备注")
    private String note;
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;


    // 列名常量
    public static final String ID = "id";
    public static final String BUSI_CODE = "busi_code";
    public static final String BUSI_NO = "busi_no";
    public static final String MAX_NUM = "max_num";
    public static final String CUR_NUM = "cur_num";
    public static final String FIRST_DELAY = "first_delay";
    public static final String INTERVAL = "interval";
    public static final String NEXT_TRIGGER_TIME = "next_trigger_time";
    public static final String STATUS = "status";
    public static final String NOTE = "note";
    public static final String CREATE_TIME = "create_time";
    public static final String UPDATE_TIME = "update_time";

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

}